/**
 * 将格林尼治时间对象转为普通的时间字符串
 * @param time 格林尼治时间对象
 * @returns {string}
 * @constructor
 */
export function GMTToStr(time){
  let date = new Date(time);
  let year = date.getFullYear();
  let month = (date.getMonth() + 1).toString().length == 1? '0' + (date.getMonth() + 1): (date.getMonth() + 1);
  let day = date.getDate().toString().length == 1? '0' + date.getDate(): date.getDate();
  let hour = date.getHours().toString().length == 1? '0' + date.getHours(): date.getHours();
  let minute = date.getMinutes().toString().length == 1? '0' + date.getMinutes(): date.getMinutes();
  let second = date.getSeconds().toString().length == 1? '0' + date.getSeconds(): date.getSeconds();
  let Str = `${year}-${month}-${day} ${hour}:${minute}:${second}`;
  return Str;
}

/**
 * 将时间字符串转为格林尼治时间对象
 * @param time
 * @returns {Date}
 * @constructor
 */
export function StrToGMT(time){
  let GMT = new Date(time);
  return GMT;
}
